package com.gitee.huanminabc.jtimerwheel.mode;


import com.gitee.huanminabc.jtimerwheel.base.TimeSlotInfo;
import com.gitee.huanminabc.jtimerwheel.base.TimerResolverCore;
import com.gitee.huanminabc.jtimerwheel.base.TimerWheelModeMethod;
import com.gitee.huanminabc.jtimerwheel.utils.TimerWheelDateUtil;

/**
 * 判断指定时间,初的时间
 *
 * @Author: huanmin
 * @Date: 2022/12/1 0:16
 * @Version: 1.0
 * @Description: 文件作用详细描述....
 */
public class TimeBeginMode implements TimerWheelModeMethod {
    @Override
    public void modeMethod(TimeSlotInfo item, int seat, TimerResolverCore timerResolver) {
        if (seat == 0) { //秒数
            timerResolver.timestamp= TimerWheelDateUtil.getDateNextSecond(TimerWheelDateUtil.secondTurnDate(timerResolver.timestamp));
        } else if (seat == 1) { //分钟数
            timerResolver.timestamp=  TimerWheelDateUtil.getDateNextMinute(TimerWheelDateUtil.secondTurnDate(timerResolver.timestamp));
        } else if (seat == 2) { //小时数
            timerResolver.timestamp=  TimerWheelDateUtil.getDateNextHour(TimerWheelDateUtil.secondTurnDate(timerResolver.timestamp));
        } else if (seat == 3) {// 天数
            timerResolver.timestamp=  TimerWheelDateUtil.getDateNextDay(TimerWheelDateUtil.secondTurnDate(timerResolver.timestamp));
        } else if (seat == 4) {// 星期数
            timerResolver.timestamp=  TimerWheelDateUtil.getDateNextWeekStart(TimerWheelDateUtil.secondTurnDate(timerResolver.timestamp));
        } else if (seat == 5) {// 月数
            timerResolver.timestamp=  TimerWheelDateUtil.getDateNextMonth(TimerWheelDateUtil.secondTurnDate(timerResolver.timestamp));
        } else if (seat == 6) {// 年数
            timerResolver.timestamp=  TimerWheelDateUtil.getDateNextYear(TimerWheelDateUtil.secondTurnDate(timerResolver.timestamp));
        }

    }
}
